﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Qreed.Xna.Font
{
    /// <summary>
    /// Kerning information
    /// </summary>
    public class VectorFontCharacterKerningPair : IComparable
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="VectorFontCharacterKerningPair"/> class.
        /// </summary>
        /// <param name="leftCharacter">The left character.</param>
        /// <param name="rightCharacter">The right character.</param>
        public VectorFontCharacterKerningPair(char leftCharacter, char rightCharacter)
        {
            _left = leftCharacter;
            _right = rightCharacter;
        }

        private char _left;
        /// <summary>
        /// Gets the left.
        /// </summary>
        /// <value>The left.</value>
        public char Left
        {
            get { return this._left; }
        }

        private char _right;
        /// <summary>
        /// Gets the right.
        /// </summary>
        /// <value>The right.</value>
        public char Right
        {
            get { return this._right; }            
        }

        /// <summary>
        /// Serves as a hash function for a particular type.
        /// </summary>
        /// <returns>
        /// A hash code for the current <see cref="T:System.Object"/>.
        /// </returns>
        public override int GetHashCode()
        {
            return (((int)this.Left) << 16) + ((int)this.Right);
        }

        #region IComparable Members

        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>
        /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance is less than <paramref name="obj"/>. Zero This instance is equal to <paramref name="obj"/>. Greater than zero This instance is greater than <paramref name="obj"/>.
        /// </returns>
        /// <exception cref="T:System.ArgumentException">
        /// 	<paramref name="obj"/> is not the same type as this instance. </exception>
        public int CompareTo(object obj)
        {
            return GetHashCode() - obj.GetHashCode();    
        }

        #endregion
    }
}
